import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  mode: "hash",
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "默认路径",
      redirect: "/login",
    },
    {
      path: "/login",
      name: "登录",
      component: () => import('@/views/Login.vue'),
    },
    {
      path: "/main",
      redirect:'/chat',
      name: "主窗口",
      component: () => import('@/views/Main.vue'),
      children: [
        {
          path: '/chat',
          name:'聊天',
          component: () => import('@/views/chat/index.vue'),
        },
        {
          path: '/contact',
          name:'联系人',
          component: () => import('@/views/contact/index.vue'),
        },
        {
          path: '/collection',
          name:'收藏',
          component: () => import('@/views/collection/index.vue'),
        },
      ]
    },
    {
      path: "/contact/add",
      name: "添加联系人",
      component: () => import('@/views/contact/add/index.vue'),
    },

    {
      path: "/contact/apply/:uid/:type",
      name: "申请添加联系人",
      component: () => import('@/views/contact/apply/index.vue'),
    },    {
      path: "/setting",
      name: "设置",
      component: () => import('@/views/setting/index.vue'),
    },
    {
      path: "/call/:uId/:sessionId/:type/:status",
      name: "通话",
      component: () => import('@/views/call/index.vue'),
    },
    {
      path: "/notice/call/:uId/:sessionId/:type",
      name: "通话邀请",
      component: () => import('@/views/notice/call/index.vue'),
    },

  ]
})
export default router
